<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>WB32L003 Standard Peripherals Firmware Library: wb32l003_spi.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">WB32L003 Standard Peripherals Firmware Library
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_6d2d5b60bd20db849a9486835a2715aa.html">Libraries</a></li><li class="navelem"><a class="el" href="dir_5ec8cccc32fa528457f3b4ed28e1a2cf.html">WB32L003_StdPeriph_Driver</a></li><li class="navelem"><a class="el" href="dir_cb9a941ec225bfb9bad4e8246158e282.html">inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">wb32l003_spi.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="wb32l003__spi_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">/* Define to prevent recursive inclusion -------------------------------------*/</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#ifndef __WB32L003_SPI_H</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#define __WB32L003_SPI_H</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160; <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">/* Includes ------------------------------------------------------------------*/</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &quot;wb32l003.h&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">/* Exported types ------------------------------------------------------------*/</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="struct_s_p_i___init_type_def.html">   34</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;{</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;  uint8_t SPI_TransferMode;</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;  uint8_t SPI_CPOL;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;  uint8_t SPI_CPHA;</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;  uint8_t SPI_BaudRatePrescaler;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;} <a class="code" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a>;</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">/* Exported constants --------------------------------------------------------*/</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">#define SPI_MODE_SLAVE                      ((uint8_t)0x00U)</span></div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">#define SPI_MODE_MASTER                     ((uint8_t)SPI_CR_MSTR)</span></div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="preprocessor">#define SPI_CPOL_Low                        ((uint8_t)0x00U)</span></div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#define SPI_CPOL_High                       ((uint8_t)SPI_CR_CPOL)</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;<span class="preprocessor">#define SPI_CPHA_1Edge                      ((uint8_t)0x00U)</span></div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="preprocessor">#define SPI_CPHA_2Edge                      ((uint8_t)SPI_CR_CPHA)</span></div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="preprocessor">#define SPI_NSS_MODE_HIGH                   ((uint8_t)SPI_SSN_SSN)</span></div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="preprocessor">#define SPI_NSS_MODE_LOW                    ((uint8_t)0x00U)</span></div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="preprocessor">#define SPI_BAUD_RATE_PRESCALER_2           ((uint8_t)0x00U)</span></div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="preprocessor">#define SPI_BAUD_RATE_PRESCALER_4           ((uint8_t)SPI_CR_SPR0)</span></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="preprocessor">#define SPI_BAUD_RATE_PRESCALER_8           ((uint8_t)SPI_CR_SPR1)</span></div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="preprocessor">#define SPI_BAUD_RATE_PRESCALER_16          ((uint8_t)(SPI_CR_SPR0 | SPI_CR_SPR1))</span></div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="preprocessor">#define SPI_BAUD_RATE_PRESCALER_32          ((uint8_t)SPI_CR_SPR2)</span></div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="preprocessor">#define SPI_BAUD_RATE_PRESCALER_64          ((uint8_t)(SPI_CR_SPR2 | SPI_CR_SPR0))</span></div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="preprocessor">#define SPI_BAUD_RATE_PRESCALER_128         ((uint8_t)(SPI_CR_SPR2 | SPI_CR_SPR1))</span></div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="preprocessor">#define SPI_FLAG_SPIF                       ((uint8_t)SPI_SR_SPIF)  </span><span class="comment">/* SPI status flag: Tx ok flag */</span><span class="preprocessor"></span></div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="preprocessor">#define SPI_FLAG_WCOL                       ((uint8_t)SPI_SR_WCOL)  </span><span class="comment">/* SPI status flag: write conflict  flag */</span><span class="preprocessor"></span></div><div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="preprocessor">#define SPI_FLAG_SSERR                      ((uint8_t)SPI_SR_SSERR) </span><span class="comment">/* SPI Error flag: Slave SSN flag */</span><span class="preprocessor"></span></div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="preprocessor">#define SPI_FLAG_MDF                        ((uint8_t)SPI_SR_MDF)   </span><span class="comment">/* SPI Error flag: Master Mode error flag */</span><span class="preprocessor"></span></div><div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;<span class="comment">/* Exported macro ------------------------------------------------------------*/</span></div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;<span class="preprocessor">#define IS_SPI_MODE(MODE) (((MODE) == SPI_MODE_SLAVE) || \</span></div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="preprocessor">                           ((MODE) == SPI_MODE_MASTER))</span></div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="preprocessor">#define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_Low) || \</span></div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;<span class="preprocessor">                           ((CPOL) == SPI_CPOL_High))</span></div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;<span class="preprocessor">#define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1Edge) || \</span></div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="preprocessor">                           ((CPHA) == SPI_CPHA_2Edge))</span></div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="preprocessor">#define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_MODE_HIGH) || \</span></div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;<span class="preprocessor">                         ((NSS) == SPI_NSS_MODE_LOW))</span></div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;<span class="preprocessor">#define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BAUD_RATE_PRESCALER_2)  || \</span></div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;<span class="preprocessor">                                              ((PRESCALER) == SPI_BAUD_RATE_PRESCALER_4)  || \</span></div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;<span class="preprocessor">                                              ((PRESCALER) == SPI_BAUD_RATE_PRESCALER_8)  || \</span></div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<span class="preprocessor">                                              ((PRESCALER) == SPI_BAUD_RATE_PRESCALER_16) || \</span></div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;<span class="preprocessor">                                              ((PRESCALER) == SPI_BAUD_RATE_PRESCALER_32) || \</span></div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="preprocessor">                                              ((PRESCALER) == SPI_BAUD_RATE_PRESCALER_64) || \</span></div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;<span class="preprocessor">                                              ((PRESCALER) == SPI_BAUD_RATE_PRESCALER_128))</span></div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;<span class="preprocessor">#define IS_SPI_ALL_PERIPH(PERIPH) ((PERIPH) == SPI)</span></div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;<span class="comment">/* Exported functions --------------------------------------------------------*/</span></div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_p_i.html#gae33578348c53fb7140d994563bdf8ae4">SPI_DeInit</a>(<a class="code" href="struct_s_p_i___type_def.html">SPI_TypeDef</a>* SPIx);</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_p_i.html#ga8dacc1dc48bf08c0f12da409f4889037">SPI_Init</a>(<a class="code" href="struct_s_p_i___type_def.html">SPI_TypeDef</a> *SPIx, <a class="code" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a> *SPI_InitStruct);</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_p_i.html#gaa31357879a65ee1ed7223f3b9114dcf3">SPI_Cmd</a>(<a class="code" href="struct_s_p_i___type_def.html">SPI_TypeDef</a> *SPIx, FunctionalState NewState);</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_p_i.html#ga8381d7b9faeb801481d0440a284ea5b7">SPI_NSSConfig</a>(<a class="code" href="struct_s_p_i___type_def.html">SPI_TypeDef</a> *SPIx, FunctionalState NewState);</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;uint8_t <a class="code" href="group___s_p_i.html#gaf66ea17ceb7a970aa0bd9103c7fe7af0">SPI_ReadData</a>(<a class="code" href="struct_s_p_i___type_def.html">SPI_TypeDef</a> *SPIx);</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_p_i.html#gaceed77570b964d304601272b48581afb">SPI_WriteData</a>(<a class="code" href="struct_s_p_i___type_def.html">SPI_TypeDef</a> *SPIx, uint8_t Data);</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;FlagStatus <a class="code" href="group___s_p_i.html#ga680c68d0ae518c16f066e13aa4dc9e7a">SPI_GetFlagStatus</a>(<a class="code" href="struct_s_p_i___type_def.html">SPI_TypeDef</a> *SPIx, uint8_t SPI_FLAG);</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;<span class="preprocessor">#ifdef __cplusplus</span></div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;}</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/*__WB32L003_SPI_H */</span><span class="preprocessor"></span></div><div class="ttc" id="struct_s_p_i___type_def_html"><div class="ttname"><a href="struct_s_p_i___type_def.html">SPI_TypeDef</a></div><div class="ttdef"><b>Definition:</b> wb32l003.h:309</div></div>
<div class="ttc" id="group___s_p_i_html_gaceed77570b964d304601272b48581afb"><div class="ttname"><a href="group___s_p_i.html#gaceed77570b964d304601272b48581afb">SPI_WriteData</a></div><div class="ttdeci">void SPI_WriteData(SPI_TypeDef *SPIx, uint8_t Data)</div><div class="ttdoc">Write one data to DATA register.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.c:138</div></div>
<div class="ttc" id="group___s_p_i_html_ga8dacc1dc48bf08c0f12da409f4889037"><div class="ttname"><a href="group___s_p_i.html#ga8dacc1dc48bf08c0f12da409f4889037">SPI_Init</a></div><div class="ttdeci">void SPI_Init(SPI_TypeDef *SPIx, SPI_InitTypeDef *SPI_InitStruct)</div><div class="ttdoc">Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.c:63</div></div>
<div class="ttc" id="group___s_p_i_html_ga8381d7b9faeb801481d0440a284ea5b7"><div class="ttname"><a href="group___s_p_i.html#ga8381d7b9faeb801481d0440a284ea5b7">SPI_NSSConfig</a></div><div class="ttdeci">void SPI_NSSConfig(SPI_TypeDef *SPIx, FunctionalState NewState)</div><div class="ttdoc">Enables or disables the specified slave select line.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.c:108</div></div>
<div class="ttc" id="group___s_p_i_html_gae33578348c53fb7140d994563bdf8ae4"><div class="ttname"><a href="group___s_p_i.html#gae33578348c53fb7140d994563bdf8ae4">SPI_DeInit</a></div><div class="ttdeci">void SPI_DeInit(SPI_TypeDef *SPIx)</div><div class="ttdoc">Deinitializes the SPIx peripheral registers to their default reset values.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.c:40</div></div>
<div class="ttc" id="struct_s_p_i___init_type_def_html"><div class="ttname"><a href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></div><div class="ttdoc">SPI Init structure definition.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.h:34</div></div>
<div class="ttc" id="group___s_p_i_html_gaf66ea17ceb7a970aa0bd9103c7fe7af0"><div class="ttname"><a href="group___s_p_i.html#gaf66ea17ceb7a970aa0bd9103c7fe7af0">SPI_ReadData</a></div><div class="ttdeci">uint8_t SPI_ReadData(SPI_TypeDef *SPIx)</div><div class="ttdoc">Read one data from DATA register.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.c:125</div></div>
<div class="ttc" id="group___s_p_i_html_ga680c68d0ae518c16f066e13aa4dc9e7a"><div class="ttname"><a href="group___s_p_i.html#ga680c68d0ae518c16f066e13aa4dc9e7a">SPI_GetFlagStatus</a></div><div class="ttdeci">FlagStatus SPI_GetFlagStatus(SPI_TypeDef *SPIx, uint8_t SPI_FLAG)</div><div class="ttdoc">Checks whether the specified SPIx flag is set or not.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.c:156</div></div>
<div class="ttc" id="group___s_p_i_html_gaa31357879a65ee1ed7223f3b9114dcf3"><div class="ttname"><a href="group___s_p_i.html#gaa31357879a65ee1ed7223f3b9114dcf3">SPI_Cmd</a></div><div class="ttdeci">void SPI_Cmd(SPI_TypeDef *SPIx, FunctionalState NewState)</div><div class="ttdoc">Enables or disables the specified SPI peripheral.</div><div class="ttdef"><b>Definition:</b> wb32l003_spi.c:87</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by Westberry Technology (ChangZhou) Corp., Ltd. All rights reserved.
</small></address>
</body>
</html>
